<?php

namespace App\Modules\Admin\Http\Controllers;

use App\Http\Controllers\BaseController;
use App\Modules\Admin\Services\ActivityFormService;
use Illuminate\Http\Request;

class ActivityFormController extends BaseController
{
    public function __construct(ActivityFormService $activityFormService)
    {
        $this->middleware('check.adminLogin')->except('index');

        $this->activityFormService = $activityFormService;
    }

    public function index()
    {
        $param = $this->validationParameter([
            'page|页码' => 'noRequire|number|default:1',
            'per_page|显示数量' => 'noRequire|number|default:30',
            'audit_status|审核状态' => 'noRequire',
            'phone|手机号码' => 'noRequire',
            'activity_id|活动id' => 'noRequire',
        ]);

        $data = $this->activityFormService->getList($param);

        return $this->response->success($data);
    }

    public function setAuditStatus(Request $request)
    {
        $param = $this->validationParameter([
            'ids|ids' => 'require|array',
            'audit_status|审核状态' => 'require',
        ]);

        $result = $this->activityFormService->setAuditStatus($param);

        return $this->response->success($result);

    }
}
